package com.webchat.test;

import com.webchat.chat.core.dto.customerDto.UserDto;
import com.webchat.chat.core.dto.evenMessage.MsgInfo;
import com.webchat.chat.model.ChatRecord;
import com.webchat.chat.model.Tenant;
import com.webchat.chat.service.ChatRecordService;
import com.webchat.chat.service.SocketClientService;
import com.webchat.chat.service.TenantService;
import org.junit.Test;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * Created by Owner on 2018/7/5.
 */
public class testChatRecord  extends Tester{
    @Resource
    private ChatRecordService chatRecordService;
    @Resource
    private SocketClientService socketClientService;
    @Resource
    private TenantService tenantService;

    @Test
    public  void findById() {
        ChatRecord chatRecord = chatRecordService.findById("0fe57ae3-325a-11e8-840b-704d7b7036d3");
        System.out.println(chatRecord);
        MsgInfo data = chatRecord.getMsg();
        System.out.println(data);
    }

    @Test
    public  void paseDateToDouble() {
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmss");
        double d = Double.parseDouble(format.format(date));
        System.out.println(d);
    }


    @Test
    public  void findCustomer() {
        List<UserDto> customer = socketClientService.findCustomer("1");
        System.out.println(customer);
    }

    @Test
    public  void findTenant() {
        Tenant tenant= tenantService.findBy("tenantCode", "1");
        System.out.println(tenant+"-------------------------------------");
    }

}
